class OrdersList{

  final List<OrderItem> list;

  OrdersList(this.list);
  factory OrdersList.fromJson(List<dynamic> itemlist){
    return OrdersList(
      itemlist.map((item) => OrderItem.fromJson(item)).toList(),
    );
  }

  // final Map<String, OrderItem> map;

  // OrdersMap(this.map);
  // factory OrdersMap.fromJson(List<dynamic> itemlist) {
  //   Map<String, OrderItem> map = new Map();
  //   for (var item in itemlist) {
  //     map[OrderItem.fromJson(item).id] = OrderItem.fromJson(item);
  //   }
  //   return OrdersMap(map);
  // }
}

class OrderItem {
  final String id;
  final int addressId;
  final String courierNumber;
  final double money;
  final String created;
  final String commodityId;
  final String commodityNumber;
  final int state;
  final List orderitems;

  OrderItem({
    this.id,
    this.addressId,
    this.courierNumber,
    this.money,
    this.created,
    this.commodityId,
    this.commodityNumber,
    this.state,
    this.orderitems,
  });

  factory OrderItem.fromJson(dynamic item){
    return OrderItem(
      id:item['id'],
      addressId: item['addressId'],
      courierNumber: item['courierNumber'],
      money: item['money'],
      created: item['created'],
      commodityId: item['commodityId'],
      commodityNumber: item['commodityNumber'],
      state: item['state'],
      orderitems:item['orderitems'],
    );
  }
}
